tests: Use gdk_window_new_child()
authorBenjamin Otte <otte@redhat.com>
Mon, 17 Oct 2016 18:17:03 +0000 (20:17 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 17 Oct 2016 22:22:35 +0000 (00:22 +0200)
tests/gtkoffscreenbox.c

index f8e2f0005a6b32014a4643c6bdee2144fe71f6fc..2879be67fcc48f7cbac526fb74378788ee376a83 100644 (file)
@@ -262,26 +262,16 @@ gtk_offscreen_box_realize (GtkWidget *widget)
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.event_mask = gtk_widget_get_events (widget)
-                       | GDK_EXPOSURE_MASK
-                       | GDK_POINTER_MOTION_MASK
-                       | GDK_BUTTON_PRESS_MASK
-                       | GDK_BUTTON_RELEASE_MASK
-                       | GDK_SCROLL_MASK
-                       | GDK_ENTER_NOTIFY_MASK
-                       | GDK_LEAVE_NOTIFY_MASK;
-
-  attributes.wclass = GDK_INPUT_OUTPUT;
-
-  attributes_mask = GDK_WA_X | GDK_WA_Y;
-
-  window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                           &attributes, attributes_mask);
+  window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
+                                 gtk_widget_get_events (widget)
+                                 | GDK_EXPOSURE_MASK
+                                 | GDK_POINTER_MOTION_MASK
+                                 | GDK_BUTTON_PRESS_MASK
+                                 | GDK_BUTTON_RELEASE_MASK
+                                 | GDK_SCROLL_MASK
+                                 | GDK_ENTER_NOTIFY_MASK
+                                 | GDK_LEAVE_NOTIFY_MASK,
+                                 &allocation);
   gtk_widget_set_window (widget, window);
   gdk_window_set_user_data (window, widget);
 
@@ -289,9 +279,22 @@ gtk_offscreen_box_realize (GtkWidget *widget)
                    G_CALLBACK (pick_offscreen_child), offscreen_box);
 
   attributes.window_type = GDK_WINDOW_OFFSCREEN;
+  attributes.wclass = GDK_INPUT_OUTPUT;
+  attributes.event_mask = gtk_widget_get_events (widget)
+                          | GDK_EXPOSURE_MASK
+                          | GDK_POINTER_MOTION_MASK
+                          | GDK_BUTTON_PRESS_MASK
+                          | GDK_BUTTON_RELEASE_MASK
+                          | GDK_SCROLL_MASK
+                          | GDK_ENTER_NOTIFY_MASK
+                          | GDK_LEAVE_NOTIFY_MASK;
+
+  attributes_mask = GDK_WA_X | GDK_WA_Y;
 
   /* Child 1 */
   attributes.x = attributes.y = 0;
+  attributes.width = allocation.width;
+  attributes.height = allocation.height;
   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
     {
       gtk_widget_get_allocation (offscreen_box->child1, &child_area);